From 88c71fd5f68e01d6031d958b5d245dee68512d6a Mon Sep 17 00:00:00 2001 From: Xan Lopez Date: Tue, 29 May 2007 22:13:42 +0000 Subject: [PATCH] Small cleanup in gtk_notebook_set_current_page and fix doc typo. svn path=/trunk/; revision=17979 --- gtk/gtknotebook.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index f7843cd4ec..9b7dbe37b9 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -6247,7 +6247,7 @@ gtk_notebook_get_current_page (GtkNotebook *notebook) /** * gtk_notebook_get_nth_page: * @notebook: a #GtkNotebook - * @page_num: the index of a page in the noteobok, or -1 + * @page_num: the index of a page in the notebook, or -1 * to get the last page. * * Returns the child widget contained in page number @page_num. @@ -6355,13 +6355,10 @@ gtk_notebook_set_current_page (GtkNotebook *notebook, g_return_if_fail (GTK_IS_NOTEBOOK (notebook)); - if (page_num >= 0) - list = g_list_nth (notebook->children, page_num); - else - list = g_list_last (notebook->children); - - page_num = g_list_index (notebook->children, list); + if (page_num < 0) + page_num = g_list_length (notebook->children) - 1; + list = g_list_nth (notebook->children, page_num); if (list) gtk_notebook_switch_page (notebook, GTK_NOTEBOOK_PAGE (list), page_num); } -- 2.30.2